import { request } from "./request"


// 奖励明细
export const rewardDetails = () => {
	return request({
		url: 'v1/rewardDetails/details',
		method: 'POST',
	})
}

// 立即抽奖
export const lotteryDraw = () => {
	return request({
		url: 'v1/rewardDetails/lotteryDraw',
		method: 'POST',
	})
}

// 我的中奖记录
export const myRewardDetails = () => {
	return request({
		url: 'v1/rewardDetails/myRewardDetails',
		method: 'POST',
	})
}


// 我的中奖记录
export const prizeList = () => {
	return request({
		url: 'v1/lotteryDraw/prizeList',
		method: 'POST',
	})
}

// 我的奖池
export const myVipReward = () => {
	return request({
		url: 'v1/rewardMember/myVipReward',
		method: 'POST',
	})
}

// 所有人中奖记录
export const allRewardDetails = () => {
	return request({
		url: 'v1/rewardDetails/allRewardDetails',
		method: 'POST',
	})
}

// 好友排行榜
export const friendRanking = () => {
	return request({
		url: 'v1/rewardMember/friendRanking',
		method: 'POST',
	})
}

// 奖励兑换
export const rewardExchange = ({studentId, exchangeCount}) => {
	return request({
		url: 'v1/rewardMember/rewardExchange',
		method: 'POST',
		data:{
			studentId,
			exchangeCount
		}
	})
}

// 管小孩小程序扫码绑定
export const qrCodeBind = ({memberId}) => {
	return request({
		url: 'v1/rewardMember/qrCodeBind',
		method: 'POST',
		data:{
			memberId
		}
	})
}

// 获取孩子手机权限开启状态详情
export const getMobilePermission = ({studentId,	studentMobileBrand,	studentSystemVersion, channel}) => {
	return request({
		url: 'v1/mobilePermission/mobilePermissionCheck',
		method: 'GET',
		data: {
			channel,
			studentId,
			studentMobileBrand,
			studentSystemVersion
		}
	})
}


// 奖励详细信息
export const rewardMessage = () => {
	return request({
		url: 'v1/rewardConfig/rewardMessage',
		method: 'POST',
	})
}


// 生成微信 scheme
export const generatescheme = ({callback, access_token, ...other}) =>{
	return uni.request({
		 url: `https://api.weixin.qq.com/wxa/generatescheme?access_token=${access_token}`, //仅为示例，并非真实接口地址。
		 data: other,
		 success:(res => {
			 callback?.(res)
		 })
	})
}


// 展示二维码
export const shareQRCode = ({shareCode}) => {
	return request({
		url: 'v1/rewardConfig/shareQRCode',
		method: 'POST',
		data:{
			shareCode
		}
	})
}
